package com.thrd.taiexhibition.fragement.enterprise;

import android.os.Bundle;
import android.view.View;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.thrd.basicframework.bean.BaseFragment;
import com.thrd.basicframework.bean.BaseRecyclerAdapter;
import com.thrd.basicframework.ui.recyclerview.SpacesItemDecoration;
import com.thrd.basicframework.utils.DensityUtil;
import com.thrd.taiexhibition.R;
import com.thrd.taiexhibition.adapter.SocietyAdapter;
import com.thrd.taiexhibition.bean.BeanCooperation;

import java.util.List;

/**
 * 社会合作
 * @author: ${唐杰}
 * @date: 2021/3/31
 */
public class SocietyFragment extends BaseFragment {

    private RecyclerView mRecyclerView;
    private List<BeanCooperation> mBeanCooperationList;
    private SocietyAdapter mAdapter;

    @Override
    protected int setLayoutResourceID() {
        return R.layout.fragment_society;
    }

    @Override
    protected void setUpView(View mContentView) {
        mRecyclerView = mContentView.findViewById(R.id.rv_recyclerview);
        LinearLayoutManager manager=  new LinearLayoutManager(getMContext());
        manager.setOrientation(RecyclerView.HORIZONTAL);
        mRecyclerView.addItemDecoration(new SpacesItemDecoration(0,0, DensityUtil.dip2px(getMContext(),16),0));
        mRecyclerView.setLayoutManager(manager);
    }

    @Override
    protected void setUpData() {
        Bundle mBundle =getArguments();
        if(mBundle!=null){
            mBeanCooperationList = (List<BeanCooperation>) mBundle.getSerializable("BeanCooperationList");
        }
        mAdapter = new SocietyAdapter(getMContext(),mBeanCooperationList);
        mRecyclerView.setAdapter(mAdapter);




        mAdapter.setItemClick(new BaseRecyclerAdapter.ItemClick<BeanCooperation>() {
            @Override
            public void onItemClick(int p, BeanCooperation e) {
                e.setCodeShow(!e.isCodeShow());
                mAdapter.notifyItemChanged(p);
            }
        });
    }






}
